﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Daco.Web.Task
{
    public class CUploadFileTask : Daco.Tasks.CLongBackgroundTask
    {
        private int _productCategoryID;
        private string _storePath;
        private int _selectedIndex;
        private List<Daco.Web.UI.WebControls.FlashUploadItem> _items;

        public CUploadFileTask(int productCategoryID, IEnumerable<Daco.Web.UI.WebControls.FlashUploadItem> items, int selectedIndex, string storePath)
        {
            _productCategoryID = productCategoryID;
            _items = new List<Daco.Web.UI.WebControls.FlashUploadItem>(items);
            _selectedIndex = selectedIndex;

            _storePath = storePath;
        }
        public override void RunOnce()
        {
            foreach (Daco.Web.UI.WebControls.FlashUploadItem item in _items)
            {
                if (!item.IsStored)
                {
                    string filePath = _storePath + item.FileName;
                    if (System.IO.File.Exists(filePath))
                    {
                        //CStore.AddProductSpecialization(_productCategoryID, item.FileName, filePath);
                    }

                }
            }
        }
    }
}
